package cn.com.guage.guc.thread;


/**
 * 
 * @author yangdechao
 *Thread.join()的作用是让父线程等待子线程结束之后才能继续运行。
 *以上述例子为例，main()方法所在的线程是父线程，在其中我们创建了3个子线程A,B,C，
 *子线程的执行相对父线程是异步的，不能保证顺序性
 */
public class FIFOThreadExample1 {
    
    public static void foo(String name) {
        System.out.println(name);
    }

    public static void main(String[] args) throws InterruptedException{
        Thread thread1 = new Thread(() -> foo("A"));
        Thread thread2 = new Thread(() -> foo("B"));
        Thread thread3 = new Thread(() -> foo("C"));
        thread1.start();
        thread1.join();
        thread2.start();
        thread2.join();
        thread3.start();
    }
}

